﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace HotelSMSSystem.Utils
{
    public class Logger
    {
        public static void Append(string com, string prefix, string message)
        {
            try
            {
                string filename = @"C:\Logs\";
                if (!Directory.Exists(filename))
                    Directory.CreateDirectory(filename);
                filename += com + "_" + DateTime.Today.ToString("yyMMdd") + ".log";
                using (StreamWriter sw = new StreamWriter(filename, true, Encoding.UTF8))
                {
                    sw.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " [" + prefix + "] " + message);
                }
            }
            catch { }
        }
    }
}
